/*
 * adc_drv.h
 *
 * Created: 13.08.2012 12:17:10
 *  Author: Timmo
 */ 


#ifndef ADC_DRV_H_
#define ADC_DRV_H_

#define ADC_set_ch0_pin(x)	ADCA.CH0.MUXCTRL=(x<<ADC_CH_MUXPOS_gp)&ADC_CH_MUXPOS_gm
#define ADC_set_ch1_pin(x)	ADCA.CH1.MUXCTRL=(x<<ADC_CH_MUXPOS_gp)&ADC_CH_MUXPOS_gm

typedef struct {
    uint8_t channel;
    uint16_t event_mode;
    int16_t threshold;
    uint8_t event_no;
    uint16_t event_delay;
}adc_event_t;

void ADC_init();
int16_t ADC_read_ch0(void);
int16_t ADC_read_ch1(void);
int16_t ADC_read_ch2(void);
int16_t get_vBat();

#endif /* ADC_DRV_H_ */